<%@ page language="java" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<%@ include file="/commons/jsp/taglibs.jsp"%>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<meta name="keywords" content="">
<meta http-equiv="Cache-Control" content="max-age=86400 public">
<meta http-equiv="X-UA-Compatible" content="IE=8">
<meta http-equiv="X-UA-Compatible" content="IE=9">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title></title>
<script type="text/javascript" src="${ctx }/web/js/jquery-1.11.2.min.js"></script>
<script type="text/javascript" src="${ctx }/web/js/1.js"></script>
<script type="text/javascript" src="${ctx }/web/js/2.js"></script>
<script type="text/javascript" src="${ctx}/commons/js/jquery.easyui.min.js"></script>
<!-- jqueryUI国际化 -->
<script type="text/javascript" src="${ctx}/commons/js/easyui-lang-zh_CN.js"></script>
<!-- 开发国际化的引用，主要完成后台信息在前台提示的国际化，一定要放在最后 -->
<script type="text/javascript">var ctx = '${ctx}';var actionExt = "action";var i18n = new Object();</script>
<script src="${ctx}/commons/js/i18n/message_zh_CN.js" type="text/javascript"></script>
<!--<link href="${ctx }/template/template_1/css/style.css" rel="Stylesheet" type="text/css" />-->
<link href="${ctx }/web/css/style.css" rel="Stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="${ctx }/web/css/basic.css">
<link rel="stylesheet" type="text/css" href="${ctx}/commons/themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="${ctx }/web/css/css.css">
<style type="text/css">
	.window-body {
		width: 278px ! important;
	}
</style>
<script>
function accountCart(){
    var selAddress = document.getElementsByName("selAddress");
    var addressId = "";
    for(var i=0;i<selAddress.length;i++){
		if(selAddress[i].checked){
			addressId = selAddress[i].value;
		}
    }
    var payMethod = document.getElementsByName("payMethod");
    var payMethodValue = "0";
    for(var i=0;i<payMethod.length;i++){
		if(payMethod[i].checked){
			payMethodValue = payMethod[i].value;
		}
    }
    if(addressId == ''){
    	$.messager.alert('提示','请选择收货地址！','info');
    } else {
    	$.ajax({
			type: "get",
			timeout:20000,
			url:  '${ctx}/web/accountCart?r='+new Date().getTime(),
			data:'addressId='+addressId+'&payMethod='+payMethodValue,
			success: function(data,res){
				if(data == 'userNotLogin'){
					$.messager.alert('提示','您长时间没有操作系统，请重新登录系统！','info',function(){top.location='${ctx}/manage';});
				} else if(data == 'success'){
					/*$.messager.confirm('提示','购买成功，要去后台查看购物的订单信息吗？',function(r){
						if (r){*/
							$('#hrefUrl').val("${ctx }/business/order/index");
							$('#toPage').submit();
						/*}
					});*/
				}
			},
			error: function(res){
			}
		});
    }
}
</script>
</head>

<body>
<div class="banbo clearfix">
    <div class="test" style="width: 100%; position:relative;">
        <!---头头--->
 <%@ include file="web-top.jsp"%>
<!------内容------>
<!---<div class="hanggao clearfix"></div>--->
<script type="text/javascript" src="js/z_2.js"></script>
 <link rel="stylesheet" type="text/css" href="css/shop.css">
    <div class="clearfix"  style="background:#FFF;">
    	<div class="neira clearfix">
        	<div class="w1200 clearfix">
                <div class="clearfix">  
                <div> 
                 <fieldset style="width:100%;margin:0 auto;padding: 10px;">
		   			<legend>设置收货地址</legend> 	
                <table style="width: 100%;background-color: #ffffff;border: 5px;border-color: #ffb754;">
                	<tr>
                		<th width="50" style="height: 60px;">选择</th><th align="left">收货地址</th><th width="200">收货人</th><th width="200">收货人手机号码</th>
                	</tr>
                	<c:forEach items="${addrs}" var="addr">
                	<tr>
                		<td width="50" style="height: 50px;" align="center"><input type="radio" ${addr.isDefault==1?"checked='checked'":"" } name="selAddress" value="${addr.id }"/></td><td>${addr.address }</td><td align="center">${addr.acceptUserName }</td><td align="center">${addr.acceptUserMobile }</td>
                	</tr>
                	</c:forEach>
                </table>
                </fieldset>
                </div>
                <div>
                <fieldset style="width:100%;padding: 10px;vertical-align: middle;">
		   			<legend>设置付款方式</legend> 
		   			<div style="padding: 20px;">
		   			<input type="radio" name="payMethod" value="0" checked="checked"/> 公务刷卡&nbsp;&nbsp;&nbsp;&nbsp;<input type="radio" name="payMethod" value="1"/> 转账付款
		   			</div>
		   		</fieldset>
		   		<div style="width: 100%;height: 60px;text-align: center;padding: 10px;">
		   		<div style="width: 100px;text-align: center;color: #fff;background-color: #FFB754;cursor: pointer;height: 30px;padding-top: 10px;float: right;" onclick="accountCart();">确定</div>
		   		</div>
		   		</div>
                </div>
            </div>
            <br />
            <br />
        </div>
    </div>
        <!--- 页脚 --->
        <%@ include file="web-buttom.jsp"%>  
    </div>
</div>
<form action="${ctx}/portal/index.jsp" id="toPage" method="post">
<input type="hidden" id="hrefUrl" name="hrefUrl" value="${ctx }/business/order/input"/>
</form>
</body>
</html>
<script type="text/javascript">
		var status = '${status}';
        if(status == 'userNotLogin'){
        	$.messager.alert('提示','您长时间没有操作系统，请重新登录系统！','info',function(){top.location='${ctx}/manage';});
        } else if(status == 'totalMoneyOutOfBudgeMoney'){
        	$.messager.alert('提示','您该项目所有的订单金额总和超过了项目预算金额，本次结算失败！','info',function(){history.back();});
        } else if(status == 'addressIsNull'){
        	$.messager.alert('提示','您没有设置收货地址，请到管理后台进行设置服务地址！','info',function(){top.location='${ctx}/portal/index.jsp';});
        } else if(status == 'notFindProject'){
        	$.messager.alert('提示','没有发现采购的项目，请到【项目管理】中选择采购项目！','info',function(){$('#hrefUrl').val("${ctx}/business/projectmanage/index");$('#toPage').submit();});
        } else if(status == 'goodsIdIsNull'){
        	$.messager.alert('提示','你没有选择采购商品，请进行选择采购商品！','info',function(){top.location = '${ctx}/web/myCart';});
        } else if(status == 'totalCountOutOfGoodsStorage'){
        	$.messager.alert('提示','您该项目中${goodsName}商品购买数量超过库存量！','info',function(){history.back();});
        }
</script>